Intra prediction apparatus

ABSTRACT

Provided is a moving picture coding apparatus for increasing a compression ratio of a moving picture signal while maintaining high image quality. To minimize the number of bits required for a residual block, quantized transform coefficients are adaptively divided into a plurality of subsets according to a size of a transform block, and non-zero quantized transform coefficients of each subset are scanned and encoded. Also, an intra prediction mode of the current block is determined using reference pixels obtained by filtering reference pixels of the current block. Accordingly, it is possible to minimize the amount of data required for the residual block of the current block.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of application Ser. No.13/624,753 filed on Sep. 21, 2012, which is a continuation ofInternational Application No. PCT/KR2011/002972 filed on Apr. 22, 2011,which claims priority to Korean Application No. 10-2010-0038158 filed onApr. 23, 2010. The applications are incorporated herein by reference.

TECHNICAL FIELD

The present invention relates to an image processing apparatus andmethod, and more particularly, to an apparatus for reducing the amountof residual signals of an image and entropy-coding the residual signals.

BACKGROUND ART

To efficiently transmit a moving picture signal at a low data rate whilemaintaining high image quality, various digital moving picturecompression technologies have been proposed. These moving picturecompression technologies include H.261, Motion Picture Experts Group(MPEG)-2/H.262, H.263, MPEG-4, Advanced Video Coding (AVC)/H.264, and soon. The compression technologies include a discrete cosine transform(DCT) scheme, a motion compensation (MC) scheme, a quantization scheme,an entropy coding scheme, and so on.

For image coding, each picture is divided into a plurality of slices,and each slice is divided into a plurality of coding blocks of apredetermined size. Since an image of a high-definition (HD) grade orabove has many flat areas, an image compression can be improved byencoding the image with coding blocks that are larger than a macroblock(MB).

Therefore, new prediction technique is required and changes in transformcoding, entropy coding, intra prediction and inter prediction isrequired as the size of the coding unit increases to increase imagecompression ratio without increase of the complexity of imagecompression.

SUMMARY OF THE DISCLOSURE

The present invention is directed to an apparatus for encoding a movingpicture, and more particularly, to an apparatus for effectively encodingtransformed residual signals of a moving picture having a predeterminedsize or more.

One aspect of the present invention provides an apparatus for encoding amoving picture, including: a coding mode determiner configured to dividean input image into coding units and determine a prediction mode of thecoding unit and a size of a predictive coding block of the coding unit;a transform/quantization unit configured to transform and quantize aresidual block between the predictive coding block and a predictionblock generated through intra prediction or inter prediction; an inversequantization/transform unit configured to inversely quantize andinversely transform the quantized transform block into a frequencydomain; a deblocking filter configured to apply a deblocking filteringprocess to image data received from the inverse quantization/transformdecoding unit; a prediction block generator configured to generate thepredictive coding block; and an entropy coder configured to encode thequantized transform coefficients from the transform coding/quantizationunit, wherein, when a size of a transform block is equal to or largerthan a predetermined size, the entropy coder divides the quantizedtransform coefficients into a plurality of subsets, and scans andentropy-codes non-zero quantized transform coefficients of the eachsubset.

The present invention enables coding efficiency to be enhanced byreducing the amount of residual signals of a block to be encoded. Also,by effectively scanning a quantized transform coefficient other than 0during entropy coding, the number of bits required for the entropycoding is minimized, such that the coding efficiency can be improved.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 shows a block division structure according to an exemplaryembodiment of the present invention.

FIG. 2 illustrates a method of determining a coding mode according tothe present invention.

FIG. 3 illustrates an apparatus for encoding a moving picture accordingto the present invention.

FIGS. 4 to 6 are diagrams illustrating an adaptive block division methodaccording to the present invention.

FIG. 7 is a diagram illustrating a method of encoding a residual signal.

DETAILED DESCRIPTION OF THE DISCLOSURE

Hereinafter, various embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.However, the present invention is not limited to the exemplaryembodiments disclosed below, but can be implemented in various types.Therefore, many other modifications and variations of the presentinvention are possible and it is to be understood that within the scopeof the disclosed concept, the present invention may be practicedotherwise than as has been specifically described.

For image coding, each picture is divided into a plurality of slices,and each slice is divided into a plurality of coding units of apredetermined size. Since an image of a high-definition (HD) grade orabove has many flat areas, an image compression ratio can be improved byencoding the image with coding units that are greater than a macroblock(MB) having a size of 16×16.

Coding unit according to the present invention may be a block having asize of 32×32 or block having a size of 64×64 as well as MBs having thesize of 16×16. Also, a block having a size of 8×8 or less may be thecoding unit. For convenience, the largest coding unit is referred to asa super macroblock (SMB). A size of the SMB may be determined accordingto information indicating a size of the smallest coding unit and depthinformation. The depth information indicates a difference between a sizeof the SMB and a size of the smallest coding unit.

Thus, coding unit that will be used for encoding all pictures of animage sequence may be SMB or sub-block of the SMB. The allowable sizesof the coding units may be designated by default or in a sequenceheader. When the allowable sizes of coding units are designated in thesequence header, the allowable sizes of the coding units are designatedaccording to the size of the smallest coding unit and the depthinformation.

Each picture or slice is divided into a plurality of SMB units. Each SMBor sub-block of the SMB may is intra-coded or inter-coded and decoded.

To enable the coding unit (i.e., an SMB or a sub-block of the SMB) to beaccurately decoded, an encoder should add size information on apredictive coding block of the coding unit and prediction modeinformation indicating that the coding unit has been coded in intraprediction mode or in inter prediction mode to a bit stream. To thisend, the prediction mode information and the information indicating thesize of the predictive coding block should be included in the bit streamof coding unit. The prediction mode varies according to a type of theslice.

When the type of the slice is intra (I), all predictive coding blocks inthe slice are intra predicted, and a prediction type of a predictivecoding block can be determined according to a size of the predictivecoding block. However, when the slice type is unidirectional prediction(P) or bidirectional prediction (B), a prediction type of a predictivecoding block may be determined according to prediction mode informationand a size of the predictive coding block. Thus, it is preferable togenerate the prediction type of the predictive coding block on the basisof the slice type, the prediction mode information and the informationindicating the size of the predictive coding block, and insert thegenerated prediction type in a header of the coding unit.

When the predictive coding block is intra-coded, intra prediction modeinformation used for intra prediction as well as the prediction typeneeds to be transmitted to a decoder.

When the predictive coding block is inter-coded, the predictive codingblock is encoded by any one of unidirectional prediction andbidirectional prediction. In the case of unidirectional prediction, abit stream should include information on a reference picture and motionvector information used for prediction as well as a prediction type ofthe predictive coding block for unidirectional prediction. In the caseof bidirectional prediction, a header of the predictive coding blockshould include information on two reference pictures and motion vectorinformation used for bidirectional prediction as well as a predictiontype of the block for bidirectional prediction. The motion vectorinformation may include information indicating a residual motion vectorand a motion vector predictor.

FIG. 1 shows a hierarchical division structure illustrating allowablepredictive coding blocks for a SMB having a size of 64×64 according toan exemplary embodiment of the present invention.

When an SMB is used as a coding unit, it is preferable to have foursub-block division steps as shown in FIG. 1, but block division is notlimited to the four sub-block division steps. When there are foursub-block division steps, a total of 13 predictive block types (64×64,64×32, 32×64, 32×32, 32×16, 16×32, 16×16, 16×8, 8×16, 8×8, 8×4, 4×8 and4×4) can be defined.

Here, there may be no data to be transmitted for inter predictive codingblocks having a greater size than an MB. Thus, it is preferable to newlyadd an MB64_SKIP mode when a size of a predictive coding block is 64×64,and an MB32_SKIP mode when the size of the predictive coding block is32×32. To transmit the mode information to the decoder, anMB64_SKIP_flag or an MB32_SKIP_flag may be used. When values of theseflags are 1, there is no transmission data of the correspondingpredictive coding block.

Meanwhile, when plural successive SMBs are not encoded, anMB64_SKIP_flag may be inserted in a first SMB only, and may be omittedin the following SMBs. In this case, the number of SMBs that aresuccessively skipped may be added to the slice or the first SMB.Specifically, when the plural of successive SMBs are not encoded, aSMB_SKIP_flag of the first SMB is set to 1, and may also be applied toseveral successive SMBs in common. In this case, informationcorresponding to the number of SMBs that are not successively encoded(e.g., an SMB_SKIP_number) may be added to the slice.

When a coding unit has a size of 32×32, block having a size of 32×32,32×16 or 16×32 in addition to existing block having a size of 16×16,16×8, 8×16, 8×8, 8×4, 4×8 or 4×4 can be used as a predictive codingblock.

In an inter-prediction mode, a prediction type (Mb32_type) of a codingunit may indicate a 32×32 partition when the prediction type is 0, a32×16 partition when the prediction type is 1, a 16×32 partition whenthe prediction type is 2, and a 16×16 partition when the prediction typeis 3.

When a coding unit is divided into four sub-coding units, the foursub-coding units are encoded and transmitted in a raster scan order. Inthis case, a quantization parameter may be transmitted for each codingunit, and may be transmitted only once in a header of a super-codingunit when the same quantization parameter is applied to all thesub-coding units. However, when a quantization parameter needs to bechanged in a sub-coding unit, only a difference value with respect to aquantization parameter of the upper layer coding unit or the precedingcoding unit of the same level may be transmitted.

Each sub-coding unit may be divided using a quadtree method, and a codedblock pattern (cbp) and a residual coefficient may also be transmittedusing the quadtree method. When a 1-bit cbp is used, a cbp value of 1may indicate that the coding unit has at least one coefficient otherthan 0, and a cbp value of 0 may indicate that all coefficients are 0.

FIG. 2 illustrates a method of determining a coding mode when a size ofan SMB is 64×64 according to the present invention.

As illustrated in FIG. 2, when an SMB is a 64×64 block, an encoderdetermines whether or not it is possible to skip the 64×64 block, anddetermines a SKIP mode as a coding mode when it is possible to skip the64×64 block. At this time, an mb64_skip_flag should be transmitted tothe decoder. When the 64×64 block has data to be encoded but is notdivided into 32×32 blocks, coding size of the SMB which is one of 64×64,64×32 and 32×64 and information about whether the SMB is intra-coded orinter-coded is inserted in an SMB header, and an SMB data block isgenerated using encoded data.

When the 64×64 block has data to be encoded and is divided into 32×32blocks, it is likewise determined whether there is data to be encoded inthe corresponding 32×32 blocks. When there is no data to be encoded inthe corresponding 32×32 blocks, the SKIP mode is determined as the 32×32block mode, and an mb32_skip_flag is transmitted to the decoder.

However, when the 32×32 block has data to be encoded but is not dividedinto 16×16 blocks, coding size of the 32×32 block which is one of 32×32,32×16 and 16×32 and information about whether the 32×32 blocks areintra-coded or inter-coded is inserted in headers of the 32×32 blocks,and a data block is generated using encoded data.

When the 32×32 block has data to be encoded and is divided into 16×16blocks, it is determined whether there is data to be encoded in thecorresponding 16×16 blocks. When there is no data to be encoded in thecorresponding 16×16 blocks, the SKIP mode is determined as the 16×16block mode, and an mb16_skip_flag is transmitted to the decoder. On theother hand, when there is data to be encoded in the corresponding 16×16blocks, coding size of the 16×16 block which is one of 16×16, 16×8 and8×16 and information about whether the 16×16 block is intra-coded orinter-coded is inserted in a header of the 16×16 block, and a data blockis generated using encoded data.

When blocks having such a variety of sizes are used, block sizeinformation may vary according to each sequence level, picture level,slice level, SMB or sub-coding unit of the SMB.

FIG. 3 illustrates an apparatus for encoding a moving picture accordingto the present invention.

Referring to FIG. 3, an apparatus for encoding a moving pictureaccording to the present invention includes a coding mode determiner110, a transform/quantization unit 120, an entropy coder 130, an intrapredictor 140, a motion compensator 150, a motion estimator 155, aninverse quantization/transform unit 160, a deblocking filter 170, apicture storage 180, an adder and a subtracter.

The coding mode determiner 110 analyzes an input video signal to dividea picture into coding units, and determines a size of a predictivecoding block and a prediction mode for each coding unit. Also, thecoding mode determiner 110 sends the predictive coding blockcorresponding to the determined size to the subtracter.

The transform/quantization unit 120 determines a size of a transformblock to transform residual signal received from the subtracter. Thesize of a transform block may be equal to or less than that of thepredictive coding block, but may be set differently in an inter mode. Inother words, the size of the transform block may be greater than that ofthe predictive coding block in the inter mode. In this case, thetransform/quantization unit 120 receives multiple residual blocks fromthe subtracter and generates one transform block consisting of themultiple residual blocks. A size of the transform block is equal to orless than that of the coding unit. The transform/quantization unit 120performs a two-dimensional (2D) discrete cosine transform (DCT) on thetransform block to generate transform coefficients. The DCT may be aninteger DCT.

Also, the transform/quantization unit 120 determines a quantization stepsize used for quantizing the transform coefficients, and quantizes thetransform coefficients using a quantization matrix determined accordingto the determined quantization step size and a coding mode.

The inverse quantization/transform unit 160 inversely quantizes andinversely transforms the quantization coefficients quantized by thetransform coding/quantization unit 120, thereby restoring a residualblock in the spatial domain from a residual block transformed into thefrequency domain.

The deblocking filter 170 receives image data that is inverselyquantized and inversely transformed from the inversequantization/transform unit 160 and performs a filtering process forremoving a blocking effect. The deblocking filtering process may beapplied to a boundary between predictive coding blocks and betweentransform blocks. The boundary is an edge of a grid having apredetermined size or more and the predetermined size may be 8×8. Thedeblocking filtering process includes a step of determining a boundaryto be filtered, a step of determining a boundary filtering strength tobe applied to the boundary, a step of determining whether or not toapply a deblocking filter, and a step of selecting a filter to beapplied to the boundary when it is determined to apply the deblockingfilter.

Whether or not to apply the deblocking filter is determined according toi) whether or not the boundary filtering strength is greater than 0 andii) whether or not a value indicating the difference between boundarypixels of P block and Q block is less than a first reference valuedetermined according to a quantization parameter.

Two or more filters may exist. When an absolute value of a differencebetween two pixels adjacent to the block boundary is equal to or greaterthan a second reference value, a weak filter is selected. The secondreference value is determined by the quantization parameter and theboundary filtering strength

The picture storage 180 receives filtered image from the deblockingfilter 170, stores the image in picture units. The picture may be animage of a frame or an image of a field. The picture storage 180 has abuffer (not shown) capable of storing a plurality of pictures.

The motion estimator 155 performs motion estimation using at least onereference picture stored in the picture storage 180, and outputs areference picture index representing the reference picture and a motionvector.

The motion compensator 150 extracts a prediction block corresponding toa block to be encoded from the reference picture used for motionestimation among a plurality of reference pictures stored in the picturestorage 180 according to the reference picture index and the motionvector input from the motion estimator 155, and outputs the extractedprediction block.

The intra predictor 140 performs intra-prediction using reconstructedpixel values in the same picture. The intra predictor 140 receives acurrent block to be predictively encoded, selects one of a predeterminednumber of intra prediction modes according to a size of the currentblock, and performs intra prediction.

The entropy coder 130 entropy-codes the quantization coefficientsquantized by the transform/quantization unit 120, motion informationgenerated by the motion estimator 155, and so on. The quantizedtransform coefficients are converted into one-dimensional (1D) quantizedtransform information by a predetermined scanning method andentropy-coded.

An intra prediction process will be described below with reference toFIG. 3.

First, the intra predictor 140 receives position and size information ona coding block to be encoded from the coding mode determiner 110.

Next, the intra predictor 140 receives valid reference pixels fordetermining an intra prediction mode of the current predictive codingblock from the picture storage 180. The reference pixels have alreadybeen encoded and restored, and are adjacent to the current predictivecoding block (hereafter, referred to as current block). When the currentblock is positioned at an upper boundary of the current picture, pixelsadjacent to the upper side of the current block are not defined. Whenthe current block is positioned at a left boundary of the currentpicture, pixels adjacent to the left side of the current block are notdefined. Also, when the current block is positioned at the upper or leftboundary of the slice, pixels adjacent to the upper or left side are notdefined.

When there are no pixels adjacent to the left or upper side of thecurrent block or there are no pixels that have been previously encodedand restored as mentioned above, an intra prediction mode of the currentblock can be determined using only valid pixels.

However, the invalid reference pixels may be generated using pixelsadjacent to the current block or available pixel. For example, whenpixels of an upper block are not valid, pixels on the upper side may begenerated using one or more available reference pixels on the left side.

Meanwhile, even when there are pixels on the upper or left side of thecurrent block, the pixels may be determined as invalid pixels accordingto a coding mode of a block to which the pixels belongs. For example,when a block to which pixels adjacent to the upper side of the currentblock belong has been inter-coded and restored, the pixels may bedetermined as invalid pixels. In this case, reference pixels may begenerated using reference pixel of a block having intra mode.

Next, the intra predictor 140 determines the intra prediction mode ofthe current block using the reference pixels. The number of intraprediction modes depends on a size of the block.

According to the size of the block, 33, 16 or 2 directional modes and atleast one non-directional mode are allowed. The non-directional mode maybe a direct current (DC) mode or a planar mode.

Different numbers of intra prediction modes can be assigned to blockshaving the same size. To indicate that different numbers of intraprediction modes are allowed, information indicating the number of intraprediction modes can be inserted in at least one of a sequence header,picture header, slice header and a coding unit header. It is preferableto insert the information in a sequence header or a picture header.

Next, when the intra prediction mode of the current block is determined,a prediction block of the current block is generated. The predictionblock is generated using reference pixels including generated pixel orusing a linear combination of the reference pixels on the basis of theintra prediction mode of the current block. For example, in adirectional mode of a specific direction, a prediction mode can begenerated using reference pixels on the upper side of the current blockand those on the left side of the current block.

The valid reference pixels used to generate the prediction block may befiltered reference pixels. A filter to be applied to the valid referencepixels may be plural in number. Also, the plurality of filters may beadaptively applied according to a size of the current block and theintra prediction mode.

Next, a residual block obtained by using the current block and theprediction block generated by the intra predictor 140 are encoded by thetransform/quantization unit 120 and the entropy coder 130.

Meanwhile, the intra prediction mode of the current block is separatelyencoded. The intra prediction mode may be encoded by the intra predictor140, a separate intra prediction mode coder (not shown) or the entropycoder 130.

The intra prediction mode of the current block is encoded using intraprediction modes of an upper block and a left block of the currentblock.

First, the intra prediction modes of the left and upper blocks of thecurrent block are derived. When the upper block is plural in number, aleftmost upper block or a block having the minimum mode number is set asan upper block of the current block. Also, when the left block is pluralin number, an uppermost left block or a block having the minimum modenumber is set as a left block of the current block. When the upper blockor the left block is not encoded in intra prediction mode, the DC mode(mode number 2) may be set as an intra prediction mode of the upperblock or the left block.

Next, when the intra prediction mode number of the upper or left blockis equal to or greater than the number of allowable intra predictionmodes of the current block, the intra prediction mode of the upper orleft block is converted into one of the intra prediction modes allowedfor the current block.

Next, when the intra prediction mode of the current block is equal toone of the intra prediction mode of the left block and the intraprediction mode of the upper block, a flag indicating that the intraprediction mode of the current block is equal to one of the intraprediction mode of the left block and the intra prediction mode of theupper block, and a flag indicating one of the intra prediction modes ofthe upper and left blocks are transmitted. In this case, when the leftand upper blocks of the current block have the same intra predictionmode, only the flag indicating that the intra prediction mode of thecurrent block is equal to one of the intra prediction mode of the leftblock and the intra prediction mode of the upper block may betransmitted. Likewise, when only one of the intra prediction modes ofthe upper and left blocks is valid and equal to that of the currentblock, only the flag indicating the intra prediction mode of the currentblock is equal to one of the intra prediction mode of the left block andthe intra prediction mode of the upper block may be transmitted.

However, when the intra prediction mode of the current block isdifferent from those of the left and upper blocks, it is determinedwhether or not the intra prediction mode number of the current block issmaller than those of the left and upper blocks.

When it is determined that both of the intra prediction mode numbers ofthe left and upper blocks of the current block are greater than theintra prediction mode number of the current block, the intra predictionmode of the current block is determined as a final intra predictionmode. However, when only one of the intra prediction mode numbers of theleft and upper blocks of the current block is not greater than the intraprediction mode number of the current block, an intra prediction modehaving a mode number obtained by subtracting 1 from the intra predictionmode number of the current block is determined as the final intraprediction mode of the current block. Also, when neither of the intraprediction mode numbers of the left and upper blocks of the currentblock is greater than the intra prediction mode number of the currentblock, an intra prediction mode having a mode number obtained bysubtracting 2 from the intra prediction mode number of the current blockis determined as the final intra prediction mode of the current block.

Next, the final intra prediction mode of the current block is encoded.Using different coding tables according to whether or not the upperblock of the current block has the same intra prediction mode as theleft block of the current block, the final intra prediction mode of thecurrent block is encoded. The intra prediction mode of the upper blockor the left block of the current block may be a modified intraprediction mode. In other words, the intra prediction mode of the upperblock or the left block of the current block may be an intra predictionmode modified by a table for mapping intra prediction modes allowablefor the upper block and the left block to a predetermined number ofintra prediction modes. The predetermined number may be 9 or 3.

A quantized transform coefficient coding process of the entropy coder130 of FIG. 3 will be described below.

The quantized transform coefficients are entropy-coded usingcontext-adaptive variable length coding (CAVLC) or context-adaptivebinary arithmetic coding (CABAC). When a size of transform block becomeslarge, there is a high possibility that a large number of bits will berequired to scan and entropy-code coefficients other than 0. Thus, it ispreferable to introduce new scan method for reducing the number of bitsfor a transform block having a size equal to or larger than apredetermined size.

First, it is determined whether or not to divide quantized transformcoefficients into a plurality of subsets. It depends on a size oftransform block. In other words, when the size of a transform block isequal to or larger than a predetermined size, the quantized transformcoefficients are divided into a plurality of subsets. The predeterminedsize may be 8×8 or 16×16. The plurality of subsets consist of one mainsubset and one or more residual subsets. The main subset is positionedat an upper left side including a DC coefficient, and the one or moreresidual subsets cover area other than area that the main subset covers.

Next, when the size of the transform block is equal to or larger thanthe predetermined size, the quantized transform coefficients are dividedinto a main subset and one or more residual subsets, and quantizedtransform coefficients included in each subset are scanned and encoded.The quantized transform coefficients in the subset may be scanned usingone of a plurality of scan patterns. A scan pattern in which the numberof bits to be encoded becomes the minimum may be selected according todistribution of non-zero pixels of the quantized transform coefficientsin the subset. The plurality of scan patterns may include zigzag scan,vertical scan and horizontal scan. Also, vertical scan or horizontalscan of Motion Picture Experts Group (MPEG)-4 may be included. When ascan pattern is transmitted for each subset, a large number of bits arerequired. Therefore one scan pattern may be applied to a plurality ofsubsets.

Meanwhile, the scan pattern may be adaptively selected according to theprediction mode and the intra prediction direction. For example, in theinter prediction mode, it is possible to apply only one predeterminedscan pattern (e.g., zigzag scan) or one of the plurality of scanpatterns. In the former case, scan pattern information does not need tobe transmitted to the decoder, but in the latter case, scan patterninformation needs to be transmitted to the decoder. In the intraprediction mode, a scan pattern can be selected according to theintra-prediction direction. For example, it is possible to applyhorizontal scan in a vertical intra prediction mode, vertical scan in ahorizontal intra prediction mode, and zigzag scan in a DC mode.

A scan pattern to be applied to the main subset and the one or moreresidual subsets may be a predetermined pattern. The predeterminedpattern may be zigzag scan. In addition to zigzag scan, horizontal scanor vertical scan may be applied to the subsets. The scan pattern appliedto the subsets may also be adaptively determined according to theprediction mode and the intra prediction direction. In other words, inthe inter prediction mode, a predetermined scan pattern may be appliedto the subsets. In the intra prediction, a scan pattern selected by theintra prediction direction may be applied to the subsets.

It may be effective to scan the quantized transform coefficients in thesubset in a reverse direction. In other words, the quantized transformcoefficients can be scanned from the last non-zero coefficient of thesubset in a reverse direction according to a scan pattern. Likewise, theplurality of subsets are scanned from a subset including the lastnon-zero coefficient of the transform block to a main subset in areverse direction

Meanwhile, for correct entropy decoding of the decoder, an encoderencodes information capable of indicating a position of the lastnon-zero coefficient in the transform block and information capable ofindicating a position of the last non-zero coefficient in each subset,and transmits the encoded information to the decoder. The informationmay indicate a position of the last non-zero coefficient in each subset.Also, the information may be map information consisting of flagsindicating whether each transform coefficients is 0 or not and flagsindicating whether the non-zero coefficient is the last non-zerocoefficient or not in the transform block. A scan pattern for generatingthe map information may be the same as the scan pattern in the subsets.

In another example for scanning quantized transform coefficients of thetransform block, the quantized transform coefficients of a transformblock may be rearranged using an interleaving method and converted intoa plurality of sub-blocks, and each of the sub-blocks may be scanned andencoded.

Meanwhile, when an image has a boundary in a specific direction and anequivalent prediction mode is used, different sub-blocks are used forsimilar data at a motion boundary portion, and unnecessary overhead mayoccur. In this case, it may be further effective to divide a coding unitin a specific direction according to a shape of the boundary portion ofthe image and perform motion estimation on each divided area.

With reference to FIGS. 4 to 6, a method of direction-adaptivelydividing a block in consideration of characteristics of an image will bedescribed. In FIGS. 4, 5 and 6, a coding unit of 32×32 will be describedas an example. However, the size of a coding unit is not limited to32×32, and the method can also be applied to a 64×64 block or a 16×16block.

In one example of the simplest adaptive mode, a coding unit is dividedinto two blocks by a straight line so as to extract statisticaldependency of a prediction area on local topography. In other words, aboundary portion of the image is matched to straight lines and divided.

As shown in the drawings, when there is a boundary that traverses animage of a 32×32 block, a boundary portion traversing the image shouldbe divided into small blocks to efficiently compress the image accordingto a conventional image division method.

Thus, as shown in FIG. 4, the one 32×32 block should be divided into atleast 10 blocks and encoded. Therefore, 10 motion vectors should betransmitted to a decoder together with information for representingimage division, and thus much additional information other than imageinformation is required.

Meanwhile, as shown in FIG. 5 or 6, when there is a boundary thattraverses the image of the 32×32 block, the number of pieces ofadditional information to be transmitted to the decoder can beremarkably reduced by matching the image boundary with at least onestraight line indicating the image boundary.

For example, when the boundary that traverses the 32×32 block is matchedto two straight lines as shown in FIG. 5, the 32×32 block is dividedinto four 16×16 blocks, and straight lines that match respective firstand fourth 16×16 blocks to a block boundary can be obtained. In thiscase, six division areas are required, and motion vectors to betransmitted to the decoder can be reduced to six.

Likewise, when the boundary that traverses the block is matched to onestraight line as shown in FIG. 6, the 32×32 block is divided into twoblocks, and only one piece of block mode information and two motionvectors need to be transmitted to the decoder.

Meanwhile, when a block is divided using a straight line, information onthe used straight line should be additionally transmitted to thedecoder. The straight line information to be transmitted will bedescribed below.

The straight line information to be transmitted can be transmitted usingvarious methods.

A first example is to represent the information on the straight lineusing a distance and angle with respect to a predetermined position. Inthis case, the predetermined position may be a pixel at the upper leftcorner or the center of the block. The distance may be an integer or aquantized value. The angle may be 0 to 180, and may also be a quantizedvalue.

A second example is to transmit position values of both ends of thestraight line that traverses the block to the decoder. The positionvalues may be expressed as values indicating how far both of the endsare from the pixel at the upper left corner of the block while goingaround the boundary of the block clockwise beginning at the upper leftcorner. In this case, either of the ends may be represented as aposition from the pixel while going around the boundary clockwise, andthe other may be represented as a position from the pixel while goingaround the boundary counterclockwise, such that straight lineinformation may be expressed. In this case, information on straightlines close to more various shapes can be expressed using a small numberof bits.

When there are neighboring blocks that have been direction-adaptivelydivided and encoded already, it is effective to transmit differentialinformation between straight line information on the current block andstraight line information on one selected from the neighboring blocks.It is more preferable to encode differential information using directioninformation on blocks divided in the same direction as the currentblock. The straight line information or differential information on thecurrent block may be expressed as one corresponding index, which may bevariable-length coded and transmitted.

Meanwhile, whether or not to apply the direction-adaptive divisionmethod may be determined according to a size of a predictive codingblock. Since the direction-adaptive division method applied to anexcessively small coding block may increase the amount of informationand complexity to be transmitted, it is preferable not to apply themethod.

As shown in FIG. 7, the method of dividing a predictive coding blockaccording to a shape of a boundary portion of an image may be appliedonly to specific directions limited to a predetermined number. Forexample, the method of dividing a block may be limited to fourdirections of a horizontal direction, a vertical direction, an upwarddiagonal direction and a downward diagonal direction, or two directionsof the horizontal direction and the vertical direction. The number ofcases of dividing the block in the specific directions may varyaccording to a size of the predictive coding block. For example, apredictive coding block having a size of 32×32 may be divided in aspecific direction (e.g., the horizontal direction) using seven methods,and a predictive coding block having a size of 16×16 may be dividedusing three methods. Also, regardless of the size of the predictivecoding block, it is possible to divide the predictive coding block usingthe same number of methods.

According to chroma, the predictive coding block can also be dividedinto the same partitions, and all the following methods can also beapplied to the division. The predictive coding block having respectivedivision areas should include, in a header, a flag indicating presenceof a division block, information indicating how the division has beenmade, and encoded reference picture indices that are referred toaccording to respective division areas.

When one block is direction-adaptively predicted, motion estimation andmotion compensation should be performed on each of two divided areas.Thus, a motion vector should be derived from each of the divided areas,and a residual signal between each of the divided areas and a referencearea obtained based on the motion vector should be derived and encoded.

A residual signal can be encoded using any one of the following methods.

First, a residual signal can be derived from each of two areas dividedfrom one predictive coding block, and then the two residual signals canbe added to form one block residual signal and transform-coded. In thiscase, it is quite possible that there will be difference between theoverall distribution of residual signals in the respective areas dividedalong a boundary, and thus it is preferable to apply a filter to theboundary.

In another method, encoding may be performed by applying shape-adaptivetransform to each of the divided areas. As shown in FIG. 7, when oneblock is divided into two areas, an upper left block is subjected tohorizontal 1D transform as it is and then vertical 1D transform, and alower right block is rearranged or rotated by 180 degrees as shown inthe drawing and subjected to 1D transform and then vertical 1Dtransform. In this case, residual coefficients separately encodedaccording to the respective division areas may be transmitted to thedecoder, or may be combined and transmitted.

In still another method, padding may be performed according to therespective divided areas to generate and encode a block. In other words,when a current division area is encoded, the other division areaconstituting the block is padded with a value of the current divisionarea to constitute the one block and then is subjected to 2D transformcoding. Padding may be horizontal padding (horizontally copying anundefined area from a defined area) and vertical padding (verticallycopying an undefined area from a defined area). In this case, it ispreferable to perform horizontal padding and then vertical padding.Also, an undefined pixel adjacent to one or more defined pixels may bepadded through linear combination of the defined pixels. Also,directionality may be given according to a division direction, such thatany one of horizontal padding and vertical padding may be performedfirst.

Next, motion vector estimation will be described.

When one block is divided into two areas using a straight line, a motionvector of each of the divided areas is differentially encoded using analready encoded motion vector.

In a first method, a first area of the divided areas may select one ofmotion vectors of adjacent blocks as a motion vector predictor, and asecond area may select one of motion vectors of adjacent blocks otherthan the first area as a motion vector predictor.

In a second method, a first area of the divided areas may select one ofmotion vectors of adjacent blocks as a motion vector predictor, and asecond area may select a motion vector of the first area as a motionvector predictor.

In a third method, when there is a direction-adaptively divided blockamong blocks adjacent to a current block, a motion vector of thedirection-adaptively divided block is used as a reference motion vectorin consideration of directivity of the divided blocks. Thus, when thereare a plurality of direction-adaptively divided blocks, motion vectorsin a predetermined sequence or motion vectors of blocks having similardivision directions may be used as reference motion vectors.

In a fourth method, a first area of the divided areas may set a motionvector of one of blocks adjacent to the first area as a motion vectorpredictor of the first area, and a second area may select any one ofmotion vectors of blocks adjacent to the second area and a motion vectorof a block or a division area at the same position in a previous pictureas a motion vector predictor and encode a differential motion vector.

Here, one straight line is used for block division. However, it is alsopossible to divide one block into at least two division areas usinginformation consisting of at least two straight lines, and coding of thedivided areas can be performed as described above.

While the invention has been shown and described with reference tocertain exemplary embodiments thereof, it will be understood by thoseskilled in the art that various changes in form and details may be madetherein without departing from the spirit and scope of the invention asdefined by the appended claims.

1. An intra prediction apparatus, comprising: an intra predictorconfigured to determine an intra prediction mode and generate aprediction block according to the intra prediction mode; atransform/quantization unit configured to transform and quantize aresidual block of the prediction block to generate a quantized block; aninverse quantization/transform unit configured to inversely quantize andinversely transform the quantized block to generate a restored residualblock; and an entropy coder configured to entropy-code quantizedcoefficients of the quantized block, wherein, when a size of thequantized block is equal to 8×8, the quantized coefficients of thequantized block are divided into a main subset and a plurality ofremaining subsets, the main subset and the remaining subsets are scannedin a reverse direction according to a scan pattern determined by theintra prediction mode, wherein the quantized coefficients of each subsetare scanned with a same scan pattern, wherein the intra prediction modeis encoded using an upper intra prediction mode and a left intraprediction mode.
 2. The apparatus of claim 1, wherein when the upperintra prediction mode is unavailable, the upper intra prediction mode isset to a DC mode.
 3. The apparatus of claim 1, wherein the main subsetincludes a DC coefficient.
 4. The apparatus of claim 1, wherein thequantized coefficients of each subset are scanned according to a scanpattern determined by the intra prediction mode.
 5. The apparatus ofclaim 4, wherein the quantized coefficients of each subset are scannedin a reverse direction.
 6. The apparatus of claim 1, wherein when theintra prediction mode is a vertical mode, the scan pattern is ahorizontal scan.
 7. The apparatus of claim 1, wherein when the intraprediction mode is a horizontal mode, the scan pattern is a verticalscan.